# -*- coding: utf-8 -*-
# @Time    : 2020/6/27 上午10:55
# @Author  : lilong


import os
import pkg_resources

# print(pkg_resources.resource_filename(__name__, "initial_project"))
#
# import rasa.utils.io as io_utils
# config = io_utils.read_config_file("/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/rasa/cli/initial_project/config.yml")
# print("config:", config)


from rasa.importers.importer import TrainingDataImporter
config = "/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/rasa/cli/initial_project/config.yml"
domain = "/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/rasa/cli/initial_project/domain.yml"
training_files = "/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/rasa/cli/initial_project/data"
# file_importer = TrainingDataImporter.load_from_config(config, domain, training_files)


# from rasa.constants import (
#     DEFAULT_LOG_LEVEL,
#     DEFAULT_LOG_LEVEL_LIBRARIES,
#     ENV_LOG_LEVEL,
#     ENV_LOG_LEVEL_LIBRARIES,
#     GLOBAL_USER_CONFIG_PATH,
# )


# log_level = os.environ.get(ENV_LOG_LEVEL, DEFAULT_LOG_LEVEL)
# print(log_level)
# log_level = logging.getLevelName(log_level)
# print("log_level:", log_level)
# print(os.environ["TF_CPP_MIN_LOG_LEVEL"])
# assert False

# from rasa import data
# _story_files, _nlu_files = data.get_core_nlu_files(training_files)

# from rasa.train import train_nlu
# output = "/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/rasa/cli/initial_project/model"
# train_path = "/Users/lilong/Desktop/rasa_dev_release/rasa_bot_426_tiny/bot_playground/tmp_dir"
# train_path = train_nlu(config, training_files, output, train_path)
# print("train_path:", train_path)


# # ---------测试rasa.model解压（模型.zip）文件
from rasa.model import get_model
model_path = "../bot_playground/bot_tiny/models/nlu/nlu-20210807-163219.tar.gz"
print(os.path.exists(model_path))
mm = get_model(model_path)
print("临时路径：", mm)





